﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;

namespace DefeatEpidemic.Models
{
    public class Community
    {
        [Key]
        public Guid id { get; set; } = Guid.NewGuid();

        [Display(Name="社区名称")]
        public string name { get; set; }

        public string province { get; set; } = "河北省";

        public string city { get; set; } = "保定市";

        public string area { get; set; } = "莲池区";

        /// <summary>
        /// 小区状态（0-正常小区，未发现病例，1-异常小区，发现病例）
        /// </summary>
        public int status { get; set; } = 0;

        /// <summary>
        /// 小区标识码（6位，用以小程序码参数）
        /// </summary>
        public string labelNumber { get; set; } = "c" + Common.Tools.GenerateInviteCode(5);

        /// <summary>
        /// 具体地址，道路，街道等，如七一东路
        /// </summary>
        [Display(Name="具体地址")]
        public string detail { get; set; }

        public string community_name
        {
            get
            {
                return $"{name}({province}{city}{area}{detail})";
            }
        }
        public DateTime created_at { get; set; } = DateTime.Now;

        public ICollection<Member> members { get; set; }
    }
}
